home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-12 | 14.3 KB | 483 lines | [TEXT/CCL2] |
-
- (in-package :TRAPS)
- ; ************************************************************
- ; Created: Monday, August 17, 1992 at 5:13 PM
- ; MoviesFormat.p
- ; Pascal Interface to the Macintosh Libraries
- ;
- ;
- ; Copyright Apple Computer, Inc. 1991, 1992
- ; All rights reserved
- ;
- ; 03/10/93 bill pulled trackDirectoryArray def out of in-line in MovieDirectory
- ; definition so that the translator could deal.
- ;
- ; ************************************************************
-
- ; $IFC UNDEFINED UsingIncludes
- ; $SETC UsingIncludes := 0
- ; $ENDC
-
- ; $IFC NOT UsingIncludes
-
- ; $ENDC
-
- ; $IFC UNDEFINED UsingMoviesFormat
- ; $SETC UsingMoviesFormat := 1
-
- ; $I+
- ; $SETC MoviesFormatIncludes := UsingIncludes
- ; $SETC UsingIncludes := 1
-
- ; $IFC UNDEFINED UsingMovies
-
- (require-interface 'MOVIES) ; $I $$Shell(PInterfaces)Movies.p
- ; $ENDC
- ; $IFC UNDEFINED UsingImageCompression
-
- (require-interface 'IMAGECOMPRESSION); $I $$Shell(PInterfaces)ImageCompression.p
- ; $ENDC
- ; $SETC UsingIncludes := MoviesFormatIncludes
-
- (defconstant $kMovieVersion 0) ; version number of the format here described
-
- ; ****************************************
- ; *
- ; * General Types -
- ; * These types are used in more than one of the
- ; * directory types.
- ; *
- ; ****************************************
-
- ; MoviesUserData is the type used for user data in movie and track directories
-
- (defrecord MoviesUserData
- (size :SIGNED-LONG) ; size of this user data
- (udType :SIGNED-LONG) ; type of user data
- (data (:ARRAY :UNSIGNED-BYTE 1)); the user data
- )
-
- (defrecord UserDataAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG)
- (userData (:ARRAY :MOVIESUSERDATA 1))
- )
-
- ; MoviesDataDescription tells us where the data for the movie or track lives.
- ; The data can follow the directory, be in the datafork of the same file as the directory resource,
- ; be in the resource fork of the same file as the directory resource, be in another file in the
- ; data fork or resource fork, or require a specific bottleneck to fetch the data.
-
- ; ***************************************
- ; *
- ; * MediaDirectory information -
- ; * The MediaDirectory is tightly coupled to the data.
- ; *
- ; ***************************************
-
- ; The SampleDescriptionTable holds the SampleDescriptions needed to decompress chunks given the
- ; SampleDescriptionID. There is a table per Media.
-
- ;
- ; SampleDescription = RECORD
- ; size : LONGINT;
- ; dataFormat : LONGINT;
- ; resvd1 : LONGINT;
- ; resvdA : INTEGER;
- ; dataRefId : INTEGER;
- ; END;
- ; SampleDescriptionHandle = ^^SampleDescription;
- ;
-
- (defrecord SampleDescriptionAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'stsd'
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (numEntries :SIGNED-LONG)
- (sampleDescTable (:ARRAY :SAMPLEDESCRIPTION 1))
- )
-
- ; TimeToSampleNum maps physical sample time to physical sample number.
-
- (defrecord TimeToSampleNum
- (sampleCount :SIGNED-LONG)
- (sampleDuration :SIGNED-LONG)
- )
-
- (defrecord TimeToSampleNumAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'stts'
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (numEntries :SIGNED-LONG)
- (timeToSampleNumTable (:ARRAY :TIMETOSAMPLENUM 1))
- )
-
- ; SyncSamples is a list of the physical samples which are self contained.
-
- (defrecord SyncSampleAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'stss'
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (numEntries :SIGNED-LONG)
- (syncSampleTable (:ARRAY :SIGNED-LONG 1))
- )
-
- (defrecord SampleToChunk
- (firstChunk :SIGNED-LONG)
- (samplesPerChunk :SIGNED-LONG)
- (sampleDescriptionID :SIGNED-LONG)
- )
-
- (defrecord SampleToChunkAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'stsc'
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (numEntries :SIGNED-LONG)
- (sampleToChunkTable (:ARRAY :SAMPLETOCHUNK 1))
- )
-
- (defrecord ChunkOffsetAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'stco'
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (numEntries :SIGNED-LONG)
- (chunkOffsetTable (:ARRAY :SIGNED-LONG 1))
- )
-
- (defrecord SampleSizeAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'stsz'
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (sampleSize :SIGNED-LONG)
- (numEntries :SIGNED-LONG)
- (sampleSizeTable (:ARRAY :SIGNED-LONG 1))
- )
-
- (defrecord ShadowSync
- (fdSampleNum :SIGNED-LONG)
- (syncSampleNum :SIGNED-LONG)
- )
-
- (defrecord ShadowSyncAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG)
- (flags :SIGNED-LONG)
- (numEntries :SIGNED-LONG)
- (shadowSyncTable (:ARRAY :SHADOWSYNC 1))
- )
-
- (defrecord SampleTableAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'stbl'
- (sampleDescription :SAMPLEDESCRIPTIONATOM)
- (timeToSampleNum :TIMETOSAMPLENUMATOM)
- (sampleToChunk :SAMPLETOCHUNKATOM)
- (syncSample :SYNCSAMPLEATOM)
- (sampleSize :SAMPLESIZEATOM)
- (chunkOffset :CHUNKOFFSETATOM)
- (shadowSync :SHADOWSYNCATOM)
- )
-
- (defrecord PublicHandlerInfo
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (componentType :SIGNED-LONG)
- (componentSubType :SIGNED-LONG)
- (componentManufacturer :SIGNED-LONG)
- (componentFlags :SIGNED-LONG)
- (componentFlagsMask :SIGNED-LONG)
- (componentName (:ARRAY :UNSIGNED-BYTE 1))
- )
-
- (defrecord HandlerAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'hdlr'
- (hInfo :PUBLICHANDLERINFO)
- )
-
- (def-mactype :DATAREFATOM (find-mactype :SIGNED-LONG))
-
- (defrecord DataInfoAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'dinf'
- (dataRef :SIGNED-LONG)
- )
-
- (defrecord RgnAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG)
- (rgnSize :SIGNED-INTEGER) ; this is the contents of a region
- (rgnBBox :RECT)
- (data (:ARRAY :UNSIGNED-BYTE 1))
- )
-
- (defrecord MatteCompressedAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG)
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (matteImageDescription :IMAGEDESCRIPTION)
- (matteData (:ARRAY :UNSIGNED-BYTE 1))
- )
-
- (defrecord MatteAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG)
- (aCompressedMatte :MATTECOMPRESSEDATOM)
- )
-
- (defrecord ClippingAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG)
- (aRgnClip :RGNATOM)
- )
-
- ; ***********************
- ; * Media Info Example Structures
- ; ***********************
-
- (defrecord VideoMediaInfoHeader
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (graphicsMode :SIGNED-INTEGER); for QD - transfer mode
- (opColorRed :SIGNED-INTEGER) ; opcolor for transfer mode
- (opColorGreen :SIGNED-INTEGER)
- (opColorBlue :SIGNED-INTEGER)
- )
-
- (defrecord VideoMediaInfoHeaderAtom
- (size :SIGNED-LONG) ; size of Media info
- (atomType :SIGNED-LONG) ; = 'vmhd'
- (vmiHeader :VIDEOMEDIAINFOHEADER)
- )
-
- (defrecord VideoMediaInfo
- (size :SIGNED-LONG) ; size of Media info
- (atomType :SIGNED-LONG) ; = 'minf'
- (header :VIDEOMEDIAINFOHEADERATOM)
- (dataHandler :HANDLERATOM)
- (dataInfo :DATAINFOATOM)
- (sampleTable :SAMPLETABLEATOM)
- )
-
- (defrecord SoundMediaInfoHeader
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (balance :SIGNED-INTEGER)
- (rsrvd :SIGNED-INTEGER)
- )
-
- (defrecord SoundMediaInfoHeaderAtom
- (size :SIGNED-LONG) ; size of Media info
- (atomType :SIGNED-LONG) ; = 'vmhd'
- (smiHeader :SOUNDMEDIAINFOHEADER)
- )
-
- (defrecord SoundMediaInfo
- (size :SIGNED-LONG) ; size of Media info
- (atomType :SIGNED-LONG) ; = 'minf'
- (header :SOUNDMEDIAINFOHEADERATOM)
- (dataHandler :HANDLERATOM)
- (dataReference :SIGNED-LONG)
- (sampleTable :SAMPLETABLEATOM)
- )
-
- (defrecord MediaInfo
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG)
- ; whatever data the media handler needs goes here
- )
-
- ; **********************
- ; * Media Directory Structures
- ; **********************
-
- (defrecord MediaHeader
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (creationTime :SIGNED-LONG) ; seconds since Jan 1904 when directory was created
- (modificationTime :SIGNED-LONG); seconds since Jan 1904 when directory was appended
- (timeScale :SIGNED-LONG) ; start time for Media (Media time)
- (duration :SIGNED-LONG) ; length of Media (Media time)
- (language :SIGNED-INTEGER)
- (quality :SIGNED-INTEGER)
- )
-
- (defrecord MediaHeaderAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG)
- (header :MEDIAHEADER)
- )
-
- (defrecord MediaDirectory
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'mdia'
- (mediaHeader :MEDIAHEADERATOM); standard Media information
- (mHandler :HANDLERATOM)
- (MediaInfo :MEDIAINFO)
- )
-
- ; **********************
- ; * Track Structures
- ; **********************
-
- (defconstant $TrackEnable 1)
- (defconstant $TrackInMovie 2)
- (defconstant $TrackInPreview 4)
- (defconstant $TrackInPoster 8)
-
- (defrecord TrackHeader
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (creationTime :SIGNED-LONG) ; seconds since Jan 1904 when directory was created
- (modificationTime :SIGNED-LONG); seconds since Jan 1904 when directory was appended
- (trackID :SIGNED-LONG)
- (reserved1 :SIGNED-LONG)
- (duration :SIGNED-LONG) ; length of track (track time)
- (reserved2 :SIGNED-LONG)
- (reserved3 :SIGNED-LONG)
- (layer :SIGNED-INTEGER)
- (alternateGroup :SIGNED-INTEGER)
- (volume :SIGNED-INTEGER)
- (reserved4 :SIGNED-INTEGER)
- (matrix :MATRIXRECORD)
- (trackWidth :SIGNED-LONG)
- (trackHeight :SIGNED-LONG)
- )
-
- (defrecord TrackHeaderAtom
- (size :SIGNED-LONG) ; size of track header
- (atomType :SIGNED-LONG) ; = 'tkhd'
- (header :TRACKHEADER)
- )
-
- (defrecord EditListType
- (trackDuration :SIGNED-LONG)
- (mediaTime :SIGNED-LONG)
- (mediaRate :SIGNED-LONG)
- )
-
- (defrecord EditListAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = elst
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (numEntries :SIGNED-LONG)
- (editListTable (:ARRAY :EDITLISTTYPE 1))
- )
-
- (defrecord EditsAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = edts
- (editList :EDITLISTATOM)
- )
-
- (defrecord TrackDirectory
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'trak'
- (trackHeader :TRACKHEADERATOM); standard track information
- (trackClip :CLIPPINGATOM)
- (edits :EDITSATOM)
- (media :MEDIADIRECTORY)
- (userData :USERDATAATOM) ; space for extending with new data types
- )
-
- (defrecord MovieHeader
- (flags :SIGNED-LONG) ; 1 byte of version / 3 bytes of flags
- (creationTime :SIGNED-LONG) ; seconds since Jan 1904 when directory was created
- (modificationTime :SIGNED-LONG); seconds since Jan 1904 when directory was appended
-
- ; Time specifications
- (timeScale :SIGNED-LONG)
- (duration :SIGNED-LONG)
-
- (preferredRate :SIGNED-LONG) ; rate at which to play this movie
- (preferredVolume :SIGNED-INTEGER); volume to play movie at
- (reserved1 :SIGNED-INTEGER)
-
- ; Graphics specifications
- (reserved2 :SIGNED-LONG)
- (reserved3 :SIGNED-LONG)
-
- (matrix :MATRIXRECORD)
-
- (previewTime :SIGNED-LONG) ; time in track the proxy begins (track time)
- (previewDuration :SIGNED-LONG); how long the proxy lasts (track time)
- (posterTime :SIGNED-LONG) ; time in track the proxy begins (track time)
- (selectionTime :SIGNED-LONG) ; time in track the proxy begins (track time)
- (selectionDuration :SIGNED-LONG); time in track the proxy begins (track time)
- (currentTime :SIGNED-LONG) ; time in track the proxy begins (track time)
- (nextTrackID :SIGNED-LONG) ; next value to use for a TrackID
- )
-
- (defrecord MovieHeaderAtom
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'mvhd'
- (header :MOVIEHEADER)
- )
-
- (defrecord trackDirectoryArray
- (TrackDirectory (:ARRAY :TRACKDIRECTORY 1))
- )
-
- (defrecord MovieDirectory
- (size :SIGNED-LONG)
- (atomType :SIGNED-LONG) ; = 'moov'
- (header :MOVIEHEADERATOM)
- (movieClip :CLIPPINGATOM)
- ; Track Directories
- (track :TRACKDIRECTORYARRAY)
- ; User data for Movie
- (userData :USERDATAATOM) ; space for user extensions
- )
-
- ; Movie formats and tags
- ; some system defined format IDs
- (defconstant $MOVIE_TYPE :|moov|)
- (defconstant $TRACK_TYPE :|trak|)
- (defconstant $MEDIA_TYPE :|mdia|)
- (defconstant $VIDEO_TYPE :|vide|)
- (defconstant $SOUND_TYPE :|soun|)
-
- ; atom id's
- (defconstant $MovieAID :|moov|)
- (defconstant $MovieHeaderAID :|mvhd|)
- (defconstant $ClipAID :|clip|)
- (defconstant $RgnClipAID :|crgn|)
- (defconstant $MatteAID :|matt|)
- (defconstant $MatteCompAID :|kmat|)
- (defconstant $TrackAID :|trak|)
- (defconstant $UserDataAID :|udta|)
- (defconstant $TrackHeaderAID :|tkhd|)
- (defconstant $EditsAID :|edts|)
- (defconstant $EditListAID :|elst|)
- (defconstant $MediaAID :|mdia|)
- (defconstant $MediaHeaderAID :|mdhd|)
- (defconstant $MediaInfoAID :|minf|)
- (defconstant $VideoMediaInfoHeaderAID :|vmhd|)
- (defconstant $SoundMediaInfoHeaderAID :|smhd|)
- (defconstant $GenericMediaInfoHeaderAID :|gmhd|)
- (defconstant $GenericMediaInfoAID :|gmin|)
- (defconstant $DataInfoAID :|dinf|)
- (defconstant $DataRefAID :|dref|)
- (defconstant $SampleTableAID :|stbl|)
- (defconstant $STSampleDescAID :|stsd|)
- (defconstant $STTimeToSampAID :|stts|)
- (defconstant $STSyncSampleAID :|stss|)
- (defconstant $STSampleToChunkAID :|stsc|)
- (defconstant $STShadowSyncAID :|stsh|)
- (defconstant $HandlerAID :|hdlr|)
- (defconstant $STSampleSizeAID :|stsz|)
- (defconstant $STChunkOffsetAID :|stco|)
- (defconstant $DataRefContainerAID :|drfc|)
-
- ; $ENDC ; UsingMoviesFormat
-
- ; $IFC NOT UsingIncludes
-
- ; $ENDC
-
- (export '($DATAREFCONTAINERAID $STCHUNKOFFSETAID $STSAMPLESIZEAID $HANDLERAID
- $STSHADOWSYNCAID $STSAMPLETOCHUNKAID $STSYNCSAMPLEAID
- $STTIMETOSAMPAID $STSAMPLEDESCAID $SAMPLETABLEAID $DATAREFAID
- $DATAINFOAID $GENERICMEDIAINFOAID $GENERICMEDIAINFOHEADERAID
- $SOUNDMEDIAINFOHEADERAID $VIDEOMEDIAINFOHEADERAID $MEDIAINFOAID
- $MEDIAHEADERAID $MEDIAAID $EDITLISTAID $EDITSAID $TRACKHEADERAID
- $USERDATAAID $TRACKAID $MATTECOMPAID $MATTEAID $RGNCLIPAID $CLIPAID
- $MOVIEHEADERAID $MOVIEAID $SOUND_TYPE $VIDEO_TYPE $MEDIA_TYPE
- $TRACK_TYPE $MOVIE_TYPE $TRACKINPOSTER $TRACKINPREVIEW $TRACKINMOVIE
- $TRACKENABLE $KMOVIEVERSION))
- (provide-interface 'MoviesFormat)